<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:include="admin/layout">

</head>
<body class="gray-bg" data-controller="user" data-action="list">
	<div class="wrapper wrapper-content" style="padding: 60px;">
   		 <div id="page-wrapper" style="min-height: 416px;">
            <div class="row">
                <div class="col-lg-12">
                    <h4 class="page-header">编辑页面</h4>
                </div>
                <!-- /.col-lg-12 -->
            </div>
             <form id="pass_form" th:action="${'/user/save'}" class="form-horizontal m-t" style="width:70%;" method="post" th:object="${user}">
          			<div class="col-md-12">
    					<div class="form-group">
        					<label class="col-sm-3 control-label">姓名</label>
        					<div class="col-sm-9">
        						<input type="hidden" class="form-control" id="role" th:value="*{role}"></input>
        						<input type="hidden" class="form-control" name="id" th:value="*{id}"></input>
            					<input type="text" class="form-control" th:value="*{name}" required="" maxlength="20" aria-required="true" name="name" placeholder="请输入不超过20位"/>
        					</div>
    					</div>
    					
    					<div class="form-group">
        					<label class="col-sm-3 control-label">年龄</label>
        					<div class="col-sm-9">
            					<input type="text"  onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();" class="form-control" required="" maxlength="3" name="age" th:value="*{age}" placeholder="请输入有效的年龄" />
        					</div>
    					</div>
    					
    					
    					<div class="form-group">
        					<label class="col-sm-3 control-label">权限</label>
        					<div class="col-sm-9">
    							<label class="radio-inline">
        							<input type="radio"  value="2" id="optionsRadios2" name="role"/>
        							文章管理员
        						</label>
        						<label class="radio-inline">
        							<input type="radio" value="3" id="optionsRadios3" name="role"/>
        							文章超级管理员
        						</label>
        						<label class="radio-inline">
        							<input type="radio" value="4" id="optionsRadios4" name="role"/>
        							专栏管理员
        						</label>
        					</div>
    					</div>
    					
    					
					</div>
					<div class="form-group">
        					<div class="col-sm-12 col-sm-offset-3">
            					<button class="btn btn-primary" type="submit">确认提交</button>
            						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            					<button class="btn btn-white" type="button" onclick="back();">返回</button>
        					</div>
    				</div>
      		</form>
     </div>
    </div>
    <script type="text/javascript">
   	     $(document).ready(function(){
 			var role=$("#role").val();
 			if(role==1){
 				$("#optionsRadios1").attr("checked","checked");
 			}else if(role==2){
 				$("#optionsRadios2").attr("checked","checked");
 			}else if(role==3){
 				$("#optionsRadios3").attr("checked","checked");
 			}else{
 				$("#optionsRadios4").attr("checked","checked");
 			}
 		});
    </script>
    <script type="text/javascript">
    	function back(){
    		history.back();
    	}
    </script>
</body>
</html>